/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package chuiniurobot.message;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chuiniu.model.ResponseCode;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.apache.mina.core.session.IoSession;

/**
 *
 * 开始猜测消息
 * @author zhengji
 */
public class StartGuessMessage extends BaseMessage{

    public StartGuessMessage(IoSession ioSession, String requestJSONStr) {
        super(ioSession, requestJSONStr);
    }

    @Override
    public void execute() {
        JSONObject jsonObj=JSON.parseObject(this.requestJSONStr);
        
        int code=jsonObj.getIntValue("c");
        
        if(code==ResponseCode.Success){
            //先猜测
                  
          
            
            /**首先猜测 2 个 【随机数】*/
            Random r=new Random();
            
            int num=r.nextInt(6)+1;
            
            this.setCurrentGuessAmount(2);
            this.setCurrentGuessNumber(num);
            
            this.sendGuessNumber();;
        }
 
    }

   
    
}
